<template>
	<view class="body">
		<img src='/static/img/moneyy.svg' class="bg-img" />
		<view class="span">{{text}}</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				text: '您正在绑定提现账户，请稍等...',
			}
		},
		mounted(){
			let url = window.location.href;
			let pos = url.lastIndexOf('?');
			let sss = url.substring(pos+1,url.length);
			let arr = sss.split('&');
			let state = '';
			let auth_code = '';
			uni.showModal({
			                title:'1111',  
			                content: arr,   
			                cancelText:  '1',   
			                confirmText: '2',   
			                showCancel: '3',   
			                success: (res) => {  
			                    if(res.confirm) {  
			                    } else {  
			                    }  
			                }  
			            });  
			for(let item of arr){
				let i = item.indexOf('=');
				let key = item.substring(0,i);
				let val = item.substring(i+1,item.length);
				console.log(key)
				if(key=='auth_code'||key=='code'){
					//走接口 换token
					auth_code = val
				}
				if(key=='state'){
					state = val;
				}
			}
			
			
			this.$req.OEMSetting("agent-apply-balance/getAuthorizeBack/white",{
				state,
				code:auth_code
			}).then(respon =>{
				if(respon.code==10000){
					uni.showToast({
						icon: 'success',
						title: '绑定成功'
					})
					this.text = '恭喜您绑定成功！'
				}
			})
		},
		methods: {
			
		}
	}
</script>

<style>
	.body{
		width: 100%;
		height: 100%;
		position: absolute;
		top: 0;
		left: 0;
	}
	.bg-img{
		height: 100%;
		width: 100%;
		object-fit: cover;
		/* object-fit: contain; */
		position: absolute;
		top: 0;
		left: 0;
		z-index: 10;
		opacity: 0.9;
	}
	.span{
		width: 100%;
		height: 40px;
		position: fixed;
		bottom: 10%;
		left: 0;
		line-height: 40px;
		text-align: center;
		z-index: 20;
		font-size: 20px;
		opacity: 0.7;
	}
</style>
